package com.gonzapps.joydroidclient.views;

import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.gonzapps.joydroidclient.main.R;

public class DPadView extends LinearLayout {
	
	private ImageView dPad;

	public DPadView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initDPadView();
	}

	public DPadView(Context context) {
		super(context);
		initDPadView();
	}
	
	private void initDPadView(){
		setFocusable(true);
		dPad = new ImageView(getContext());
		dPad.setImageResource(R.drawable.dpad_full);
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		removeView(dPad);
		
	
		
		Integer dPadWidth = getMeasuredWidth()*2;  
		Integer dPadHeight = getMeasuredHeight()*2;
		LayoutParams params = new LayoutParams(dPadWidth, dPadHeight);
		dPad.setLayoutParams(params);		
		addView(dPad);
	}	
}
